package files_controller_with_factory;
import org.apache.log4j.Logger;

public class Factory{
	private static final Logger cont_log = Logger.getLogger("control");
	 
	 ICommandExecutor test;
	 
	 public ICommandExecutor getExecute(String type){
		 if(("dir").equals(type)){
			 test=DirCommandExecutor.getInstance();
		 }else
			 if(("find").equals(type)){ 
				 test=FindCommandExecutor.getInstance();
			  }else
				 if(("tree").equals(type)){
					 	test=TreeCommandExecutor.getInstance();
					 }else
						 if(("mkdir").equals(type)){
							 test=MkdirCommandExecutor.getInstance();
						 }else
							 if(("copy").equals(type)){
								 test=CopyCommandExecutor.getInstance();
							 }else
								 if(("delete").equals(type)){
									 test=DeleteCommandExecutor.getInstance();
								 }else
									 if(("move").equals(type)){
										 test=MoveCommandExecutor.getInstance();
									 }else
										 if(("cd").equals(type)){
											 test=CdCommandExecutor.getInstance();
										 }else
											 if(("exit").equals(type)){
												 test=ExitCommandExecutor.getInstance();
											 }else
												 if(("help").equals(type)){
													 test=HelpCommandExecutor.getInstance();
												 }else{
													 cont_log.warn("Can't recognise your command, please repeat enter ");
													 test=null;
												 }	 
		 return test;
	 }
	 
}
